package cn.com.greatwall.log.config;

import org.slf4j.TtlMDCAdapter;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * @Author herw
 * @Time 2022-02-14 22:01:43
 * @Version 1.0
 * @Description: 初始化TtlMDCAdapter实例，并替换MDC中的adapter对象
 */
public class TtlMDCAdapterInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {

    @Override
    public void initialize(ConfigurableApplicationContext applicationContext) {
        // 加载TtlMDCAdapter实例
        TtlMDCAdapter.getInstance();
    }

}
